package com.rqbl.controller;


import com.rqbl.entity.Topic;
import com.rqbl.myutils.PageBean;
import com.rqbl.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bruce
 * @since 2024-07-19
 */
@Controller
@RequestMapping("/topic")
@CrossOrigin
public class TopicController {
    @Autowired
    TopicService topicService;

    @RequestMapping("/getTopicsByPage")
    @ResponseBody
    public List<Topic> getTopicsByPage(int page) {
        PageBean pageBean = new PageBean();
        pageBean.setPageSize(4);
        pageBean.setPage(page);
        return topicService.getTopicsByPage(pageBean);
    }
}
